export const isProduction = import.meta.env.MODE === 'production';

const logPrefix = `[TTThreeJS]`;

export function useLogger () {
    function logError ( message: string, error?: Error | ErrorEvent ) {
        console.error( `${ logPrefix } ${ message }`, error || '' );
    }
    function logWarning ( message: string ) {
        console.warn( `${ logPrefix } ${ message }` );
    }
    function logMessage ( name: string, value: string ) {
        if ( !isProduction ) {
            console.log( `${ logPrefix } -${ name } : ${ value }` );
        }
    }
    return {
        logError, logWarning, logMessage
    };
}